package com.example.saiweisi.service.impl.sysTemAdminService;

import com.example.saiweisi.controller.request.PageBaseRequest;
import com.example.saiweisi.mapper.systemAdminMapper.VipKindMapper;
import com.example.saiweisi.model.VipKind;
import com.example.saiweisi.service.interf.IVipKindService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class VipKindService implements IVipKindService {
    @Autowired
    VipKindMapper vipKindMapper;
    @Override
    public PageInfo<VipKind> page(PageBaseRequest pageBaseRequest) {
        PageHelper.startPage(pageBaseRequest.getPageNum(), pageBaseRequest.getPageSize());
        List<VipKind> userList = vipKindMapper.vipkindlistByCondition(pageBaseRequest);
        return new PageInfo<>(userList);
    }

    @Override
    public void addvipkind(VipKind vipKind) {
        vipKindMapper.addvipkind(vipKind);
    }

    @Override
    public void deletevipkind(Integer vipKindId) {
        vipKindMapper.deletevipkind(vipKindId);
    }

    @Override
    public VipKind getById(Integer vipKindId) {
        return vipKindMapper.getById(vipKindId);
    }

    @Override
    public void updatevipkind(VipKind vipKind) {
        vipKindMapper.updatevipkind(vipKind);
    }

    @Override
    public void deletesvipkind(List<Integer> vipKindIds) {
        for (Integer a:vipKindIds
             ) {
            vipKindMapper.deletevipkind(a);
        }
    }

    @Override
    public List<VipKind> getAll() {
        return vipKindMapper.getAll();
    }
}
